package com.hmh.student.students.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hmh.student.students.entity.Teacher;
import com.hmh.student.students.mapper.TeacherMapper;
import com.hmh.student.students.service.ITeacherService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xyf
 * @since 2025-04-16
 */
@Service
public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> implements ITeacherService {

    @Override
    public Page<Teacher> queryTeacherPage(String name, String department, Integer pageSize, Integer current) {
        QueryWrapper<Teacher> wrapper = new QueryWrapper<>();
        if (name != null && !name.isEmpty()) {
            wrapper.like("name", name);
        }
        if (department != null && !department.isEmpty()) {
               wrapper.like("department", department);
        }
        return this.page(new Page<>(current, pageSize), wrapper);
    }
}
